-
-
Notifications
You must be signed in to change notification settings - Fork 707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Snowflake: Add dollar quoted string literal #2770
Snowflake: Add dollar quoted string literal #2770
Conversation
DoubleQuotedLiteralSegment=NamedParser( | ||
"double_quote", | ||
CodeSegment, | ||
name="quoted_literal", | ||
type="literal", | ||
trim_chars=('"',), | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't part of Snowflake and isn't used anywhere in the dialect so cleaning up.
@@ -505,7 +513,7 @@ class FunctionDefinitionGrammar(BaseSegment): | |||
type = "function_definition" | |||
match_grammar = Sequence( | |||
"AS", | |||
OneOf(Ref("QuotedLiteralSegment"), Ref("DollarQuotedLiteralSegment")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DollarQuotedLiteralSegment
isn't anywhere else in the code base. We used to have it in Postgres, but was since combined with QuotedLiteralSegment
to simplify the dialect. This is probably just a holdover from when Snowflake inherited from Postgres.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Codecov Report
@@ Coverage Diff @@
## main #2770 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 163 163
Lines 12214 12214
=========================================
Hits 12214 12214
Continue to review full report at Codecov.
|
Brief summary of the change made
Snowflake allows dollar quoted string literals (similar to postgres but no tags). I've updated
QuotedLiteralSegment
to allow these and keep consistent with the postgres approach.Are there any other side effects of this change that we should be aware of?
No
Pull Request checklist
Please confirm you have completed any of the necessary steps below.
Included test cases to demonstrate any code changes, which may be one or more of the following:
.yml
rule test cases intest/fixtures/rules/std_rule_cases
..sql
/.yml
parser test cases intest/fixtures/dialects
(note YML files can be auto generated withtox -e generate-fixture-yml
).test/fixtures/linter/autofix
.Added appropriate documentation for the change.
Created GitHub issues for any relevant followup/future enhancements if appropriate.